#ifndef global_descriptor_table_h
#define global_descriptor_table_h

#include <common/types.h>

OS_NAMESPACE_BEGIN

class GlobalDescriptorTable
{
public:
	class SegmentDescriptor
	{
	private:
		OS_NAME_PREFIX::common::uint16_t limit_lo;
		OS_NAME_PREFIX::common::uint16_t base_lo;
		OS_NAME_PREFIX::common::uint8_t base_hi;
		OS_NAME_PREFIX::common::uint8_t type;
		OS_NAME_PREFIX::common::uint8_t limit_hi;
		OS_NAME_PREFIX::common::uint8_t base_vhi;

	public:
		SegmentDescriptor(OS_NAME_PREFIX::common::uint32_t base,
				  OS_NAME_PREFIX::common::uint32_t limit,
				  OS_NAME_PREFIX::common::uint8_t type);

		OS_NAME_PREFIX::common::uint32_t Base();
		OS_NAME_PREFIX::common::uint32_t Limit();
	} __attribute__((packed));

private:
	SegmentDescriptor nullSegmentSelector;
	SegmentDescriptor unusedSegmentSelector;
	SegmentDescriptor codeSegmentSelector;
	SegmentDescriptor dataSegmentSelector;

public:
	GlobalDescriptorTable();
	~GlobalDescriptorTable();

	OS_NAME_PREFIX::common::uint16_t CodeSegementSelector();
	OS_NAME_PREFIX::common::uint16_t DataSegementSelector();
};

OS_NAMESPACE_END



#endif // header file
